From 835d755b9c456a8dab5fd2c831c4b439f7f042e2 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 17 Nov 2003 14:53:06 +0000 Subject: [PATCH] Patch from Jaiserca to add a "use_markup" property. 2003-11-17 Mark McLoughlin Patch from Jaiserca to add a "use_markup" property. See bug #124449. * gtk/gtkexpander.c: (gtk_expander_class_init), (gtk_expander_init), (gtk_expander_set_property), (gtk_expander_get_property), (gtk_expander_set_label), (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): Add a "use_markup" property and use it when creating the child label. --- ChangeLog | 13 +++++++++ ChangeLog.pre-2-10 | 13 +++++++++ ChangeLog.pre-2-4 | 13 +++++++++ ChangeLog.pre-2-6 | 13 +++++++++ ChangeLog.pre-2-8 | 13 +++++++++ gtk/gtkexpander.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 137 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9a15983309..7fbf5fa7c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-11-17 Mark McLoughlin + + Patch from Jaiserca to add a + "use_markup" property. See bug #124449. + + * gtk/gtkexpander.c: + (gtk_expander_class_init), + (gtk_expander_init), (gtk_expander_set_property), + (gtk_expander_get_property), (gtk_expander_set_label), + (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): + Add a "use_markup" property and use it when creating the + child label. + Mon Nov 17 12:58:32 2003 Kristian Rietveld Temporary size requisition fix. Will fix it for real tonight. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9a15983309..7fbf5fa7c8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +2003-11-17 Mark McLoughlin + + Patch from Jaiserca to add a + "use_markup" property. See bug #124449. + + * gtk/gtkexpander.c: + (gtk_expander_class_init), + (gtk_expander_init), (gtk_expander_set_property), + (gtk_expander_get_property), (gtk_expander_set_label), + (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): + Add a "use_markup" property and use it when creating the + child label. + Mon Nov 17 12:58:32 2003 Kristian Rietveld Temporary size requisition fix. Will fix it for real tonight. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 9a15983309..7fbf5fa7c8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +2003-11-17 Mark McLoughlin + + Patch from Jaiserca to add a + "use_markup" property. See bug #124449. + + * gtk/gtkexpander.c: + (gtk_expander_class_init), + (gtk_expander_init), (gtk_expander_set_property), + (gtk_expander_get_property), (gtk_expander_set_label), + (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): + Add a "use_markup" property and use it when creating the + child label. + Mon Nov 17 12:58:32 2003 Kristian Rietveld Temporary size requisition fix. Will fix it for real tonight. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 9a15983309..7fbf5fa7c8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +2003-11-17 Mark McLoughlin + + Patch from Jaiserca to add a + "use_markup" property. See bug #124449. + + * gtk/gtkexpander.c: + (gtk_expander_class_init), + (gtk_expander_init), (gtk_expander_set_property), + (gtk_expander_get_property), (gtk_expander_set_label), + (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): + Add a "use_markup" property and use it when creating the + child label. + Mon Nov 17 12:58:32 2003 Kristian Rietveld Temporary size requisition fix. Will fix it for real tonight. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 9a15983309..7fbf5fa7c8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +2003-11-17 Mark McLoughlin + + Patch from Jaiserca to add a + "use_markup" property. See bug #124449. + + * gtk/gtkexpander.c: + (gtk_expander_class_init), + (gtk_expander_init), (gtk_expander_set_property), + (gtk_expander_get_property), (gtk_expander_set_label), + (gtk_expander_set_use_markup), (gtk_expander_get_use_markup): + Add a "use_markup" property and use it when creating the + child label. + Mon Nov 17 12:58:32 2003 Kristian Rietveld Temporary size requisition fix. Will fix it for real tonight. diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 8f739f0278..f8cc5c7bdc 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -44,6 +44,7 @@ enum PROP_EXPANDED, PROP_LABEL, PROP_USE_UNDERLINE, + PROP_USE_MARKUP, PROP_PADDING, PROP_LABEL_WIDGET }; @@ -59,6 +60,7 @@ struct _GtkExpanderPrivate guint expanded : 1; guint use_underline : 1; + guint use_markup : 1; guint button_down : 1; guint prelight : 1; }; @@ -210,6 +212,14 @@ gtk_expander_class_init (GtkExpanderClass *klass) FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, + PROP_USE_MARKUP, + g_param_spec_boolean ("use_markup", + _("Use markup"), + _("The text of the label includes XML markup. See pango_parse_markup()"), + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (gobject_class, PROP_PADDING, g_param_spec_int ("spacing", @@ -275,6 +285,7 @@ gtk_expander_init (GtkExpander *expander) priv->expanded = FALSE; priv->use_underline = FALSE; + priv->use_markup = FALSE; priv->button_down = FALSE; priv->prelight = FALSE; } @@ -298,6 +309,9 @@ gtk_expander_set_property (GObject *object, case PROP_USE_UNDERLINE: gtk_expander_set_use_underline (expander, g_value_get_boolean (value)); break; + case PROP_USE_MARKUP: + gtk_expander_set_use_markup (expander, g_value_get_boolean (value)); + break; case PROP_PADDING: gtk_expander_set_spacing (expander, g_value_get_int (value)); break; @@ -330,6 +344,9 @@ gtk_expander_get_property (GObject *object, case PROP_USE_UNDERLINE: g_value_set_boolean (value, priv->use_underline); break; + case PROP_USE_MARKUP: + g_value_set_boolean (value, priv->use_markup); + break; case PROP_PADDING: g_value_set_int (value, priv->spacing); break; @@ -1339,6 +1356,7 @@ gtk_expander_set_label (GtkExpander *expander, child = gtk_label_new (label); gtk_label_set_use_underline (GTK_LABEL (child), expander->priv->use_underline); + gtk_label_set_use_markup (GTK_LABEL (child), expander->priv->use_markup); gtk_widget_show (child); gtk_expander_set_label_widget (expander, child); @@ -1430,6 +1448,60 @@ gtk_expander_get_use_underline (GtkExpander *expander) return expander->priv->use_underline; } +/** + * gtk_expander_set_use_markup: + * @expander: a #GtkExpander + * @use_markup: %TRUE if the label's text should be parsed for markup + * + * Sets whether the text of the label contains markup in Pango's text markup + * language. See gtk_label_set_markup(). + * + * Since: 2.4 + **/ +void +gtk_expander_set_use_markup (GtkExpander *expander, + gboolean use_markup) +{ + GtkExpanderPrivate *priv; + + g_return_if_fail (GTK_IS_EXPANDER (expander)); + + priv = expander->priv; + + use_markup = use_markup != FALSE; + + if (priv->use_markup != use_markup) + { + priv->use_markup = use_markup; + + if (priv->label_widget && GTK_IS_LABEL (priv->label_widget)) + gtk_label_set_use_markup (GTK_LABEL (priv->label_widget), use_markup); + + g_object_notify (G_OBJECT (expander), "use_markup"); + } +} + +/** + * gtk_expander_get_use_markup: + * @expander: a #GtkExpander + * + * Returns whether the label's text is interpreted as marked up with + * the Pango text markup + * language. See gtk_expander_set_use_markup (). + * + * Return value: %TRUE if the label's text will be parsed for markup + * + * Since: 2.4 + **/ +gboolean +gtk_expander_get_use_markup (GtkExpander *expander) +{ + g_return_val_if_fail (GTK_IS_EXPANDER (expander), FALSE); + + return expander->priv->use_markup; +} + /** * gtk_expander_set_label_widget: * @expander: a #GtkExpander -- 2.30.2